<#include "/common/defaultEngine.html">
<@pageTheme mark="true">
<!DOCTYPE html>
<html>
<head>
    <#import "/common/springctx.ftl" as ctx>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="keywords" content="PoweredByJ2eeFast"/><meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0">
    <meta name="renderer" content="webkit">
    <title>登录 - J2eeFAST J2eefast.com</title>
    <link href="${ctxStatic}/static/img/favicon.ico" rel="shortcut icon" type="image/x-icon">
    <#-- Bootstrap 3.3.7 -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/bootstrap.min.css">
    <#-- Font Awesome -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/font-awesome.min.css">
    <#-- Ionicons -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/Ionicons/css/ionicons.min.css">
    <#-- Theme style -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/AdminLTE.min.css?V=${config.getDvVersion()}">
    <#-- iCheck -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/iCheck/all.css?V=${config.getDvVersion()}">
    <#--animate 样式-->
    <link rel="stylesheet" href="${ctxStatic}/static/css/animate.css"/>
    <#-- jQuery toast 提示框  -->
    <link rel="stylesheet" href="${ctxStatic}/static/css/jquery.toast.min.css">
    <link rel="stylesheet" href="${ctxStatic}/static/css/style.min.css?V=${config.getDvVersion()}">
    <link rel="stylesheet" href="${ctxStatic}/static/css/index.min.css?V=${config.getDvVersion()}">
    <link rel="stylesheet" type="text/css" href="${ctxStatic}/static/css/baidu/n.css">
    <link rel="stylesheet" href="${ctxStatic}/static/css/baidu/index_baidu.css">
    <link rel="stylesheet" href="${ctxStatic}/static/css/baidu/passport.css">
    <#if verification>
    <link rel="stylesheet" href="${ctxStatic}/static/plugins/captcha/css/verify.min.css">
    </#if>
    <style>
        .checkbox{
            margin-bottom: 20px !important;
        }
        .dropdown-menu>li>a {
            color: #777 !important;
        }
    </style>
</head>
<body>
<#include "/common/notice.html">
<#include "/common/upgrade.html"><!-- 如果客户浏览器版本过低，则显示浏览器升级提示-->
<div id="verfyImg">
</div>
<div class="main" id="app" v-cloak>
    <header>
        <i class="decoration"></i>
        <div class="container">
            <a href="#" style="color: #0a0a0a">
                当前版本: <small>V${config.getVersion()}</small>
            </a>
            <div class="right">
                <div class="dropdown pull-right">
                    <a href="javascript:" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">
                        <i class="fa fa-language"></i>&nbsp;<@ctx.i18n text = "中文(简体)"/>
                    </a>
                    <ul class="dropdown-menu">
                        <li class="mt5"></li>
                        <#list dict.getType('sys_lang_type')>
                            <#items as d>
                                <#if d.status =='0' >
                                    <li><a href="${ctxStatic}/login?_lang=${d.dictValue}&view=${loginView}">${d.dictLabel}</a></li>
                                </#if>
                            </#items>
                        </#list>
                        <li class="mt5"></li>
                    </ul>
                </div>
            </div>
        </div>
    </header>
    <div id="root" class="animated fadeInLeft">
        <i class="decoration"></i>
        <table cellpadding="0" cellspacing="0">
            <tbody><tr>
                <td id="brand">
                    <div>
                        <h2>${config.getTitle()}</h2>
                        <h3>
<#--                            全面、落地的 <span>AI</span><br>-->
                            J2eeFAST是一个Java EE企业级快速开发平台，<strong>致力于打造中小企业最好用的开源免费的后台框架平台</strong>. 系统基于(Spring Boot、Spring MVC 、Apache Shiro、MyBatis-Plus、 Freemarker、 Bootstrap、 AdminLTE)经典技术开发. 系统内置核心模块包含众多常用基础功能(在线代码生成功能、组织机构、角色用户、菜单及按钮授权、数据权限、系统参数、license认证、BPM工作流等)，<strong>让你用最低的成本、最高的效率，开发项目，她也适合新手朋友练手</strong>。同时具备，<strong>界面简洁美观、高效、安全、源码可控、版本迭代快、免费技术交流群</strong>等特点。她适用于所有Web应用，她会成为你快速开发项目的好帮手。
                        </h3>
                        <p class="hr"></p>
                        <#--推广-->
                        <p>
                            <a id="campaign" style="" href="https://cloud.tencent.com/act/cps/redirect?redirect=1054&cps_key=364adb8c140f09acbca26d455a0036e6&from=console">
                                <img width="366px" height="100px" src="${ctxStatic}/static/img/txms.jpg">
                            </a>
                        </p>
                    </div>
                </td>
                <td>
                    <div id="login" class="login-box uc-common-login">
                        <div id="common-login" class="login uc-common-login-small">
                            <div class="login-shadow"></div>
                            <span class="watermark"></span>
                            <div id="change-login" class="change-login">
                                <div>
                                    <a href="javascript:void(0);" class="passport-account select"><@ctx.i18n text = "欢迎登录"/></a>
<#--                                    <a id="choose-uc-login" href="javascript:void(0);">云账号<span></span></a>-->
                                </div>
                            </div>
                            <div id="passport-login">
                                <div id="passport-login-normal" class="tang-pass-login">
                                    <form id="TANGRAM__PSP_4__form" class="pass-form pass-form-normal" action="${ctxStatic}/login" method="POST" autocomplete="off">
                                        <p class="pass-form-logo">用户名密码登录</p>
                                        <p id="TANGRAM__PSP_4__errorWrapper" class="pass-generalErrorWrapper">
                                            <span id="TANGRAM__PSP_4__error" class="pass-generalError pass-generalError-error"></span>
                                        </p>
                                            <p id="TANGRAM__PSP_4__userNameWrapper" class="pass-form-item pass-form-item-userName">
                                                <input type="text" class="pass-text-input pass-text-input-userName" id="username" v-model="username" placeholder="<@ctx.i18n text = "账号/邮箱/手机号码"/>">
                                            </p>
                                        <p id="TANGRAM__PSP_4__passwordWrapper" class="pass-form-item pass-form-item-password">
                                            <input type="password" class="pass-text-input pass-text-input-password" id="password" v-model="password" autocomplete="off" placeholder="<@ctx.i18n text = "密码"/>">
                                        </p>
                                        <p id="TANGRAM__PSP_4__verifyCodeImgWrapper" class="pass-form-item pass-form-item-verifyCode" v-if="loadcode">
                                            <input id="TANGRAM__PSP_4__verifyCode" copyright="J2eeFAST" type="text" class="pass-text-input pass-text-input-verifyCode" maxlength="4"  v-model="captcha" placeholder="<@ctx.i18n text = "验证码"/>">
                                            <span class="pass-verifyCodeImgParent"><img id="TANGRAM__PSP_4__verifyCodeImg" class="pass-verifyCode" :src="src" @click="refreshCode">
                                            </span>
                                            <a id="TANGRAM__PSP_4__verifyCodeChange" href="javascript:;" @click="refreshCode" class="pass-change-verifyCode"><@ctx.i18n text = "点击刷新"/></a>
                                        </p>
                                        <p id="TANGRAM__PSP_4__memberPassWrapper" class="pass-form-item pass-form-item-memberPass">
                                                <div class="checkbox icheck">
                                                    <label title="<@ctx.i18n text = "公共场所慎用,下次登录免输账号"/>" data-toggle="tooltip" data-placement="bottom">
                                                        <input type="checkbox" name="rememberUserCode" data-style="minimal-grey" />&nbsp;<@ctx.i18n text = "记住账号"/>
                                                    </label>
                                                </div>
                                        </p>
                                        <p id="TANGRAM__PSP_4__submitWrapper" class="pass-form-item pass-form-item-submit">
                                            <input  type="button" class="pass-button pass-button-submit" @click="login" data-loading="正在验证登录，请稍后..." value="<@ctx.i18n text = "登 录"/>">
<#--                                            <a class="pass-reglink pass-link" href="#" target="_blank" id="passport-reg">立即注册</a>-->
<#--                                            <a class="pass-fgtpwd pass-link" href="#" target="_blank">忘记密码</a>-->
<#--                                            <a class="pass-sms-btn pass-link" title="短信快捷登录" data-type="sms" id="TANGRAM__PSP_4__smsSwitchWrapper">短信快捷登录</a>-->
                                        </p>
                                    </form>
                                </div>
                                <#if config.getKey("SYS_IS_OAUTH") == "0">
                                <div class="social-auth-links text-center">
                                    <div class="oauth-title">
                                        <span class="text-muted"> 其他方式登录 </span>
                                    </div>
                                    <div class="oauth-list">
                                        <div class="item" title="<@ctx.i18n text = "使用 Gitee 账号授权登录"/>" data-toggle="tooltip" data-placement="top">
                                            <a href="${ctxStatic}/auth/gitee">
                                                <img src="${ctxStatic}/static/img/gitee.svg"/>
                                            </a>
                                        </div>
                                        <div class="item" title="<@ctx.i18n text = "使用 GitHub 账号授权登录"/>" data-toggle="tooltip" data-placement="top">
                                            <a href="${ctxStatic}/auth/github">
                                                <img src="${ctxStatic}/static/img/github.svg"/>
                                            </a>
                                        </div>
                                        <div class="item" title="<@ctx.i18n text = "使用 OsChina 账号授权登录"/>" data-toggle="tooltip" data-placement="top">
                                            <a href="${ctxStatic}/auth/oschina">
                                                <img src="${ctxStatic}/static/img/oschina.svg"/>
                                            </a>
                                        </div>
                                        <div class="item" title="<@ctx.i18n text = "功能开发中..."/>" data-toggle="tooltip" data-placement="top">
                                            <a href="#">
                                                <img src="${ctxStatic}/static/img/qq-no.svg"/>
                                            </a>
                                        </div>
                                    </div>
                                </div>
                                </#if>
                                <div class="tip-wrap">
                                    <p><strong>温馨提示：</strong><br>密码若错3次以上,才会需要提交验证码。</p>
                                </div>
                        </div>
                    </div>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
    <footer>
        Copyright &copy; 2018-${config.getCopyrightYear()} ${config.getCompany()} |
        <a href="http://www.beian.miit.gov.cn/" class="text-black" target="_blank">${config.getIPC()}</a>
        <br>
        <a href="https://www.yuque.com/u1174484/j2eefast/tv3kee" target="_blank">帮助文档</a> |
        <#list dict.getType('sys_login_view')>
            <#items as d>
                <#if d.status =='0' >
                    <a href="${ctxStatic}/login?view=${d.dictValue}">${d.dictLabel}</a> |
                </#if>
            </#items>
        </#list>
    </footer>
</div>
</body>
<#--jQuery 3 -->
<script src="${ctxStatic}/static/libs/jquery.min.js"></script>
<script src="${ctxStatic}/static/libs/jquery-migrate.min.js"></script>
<#-- Bootstrap 3.3.7 -->
<script src="${ctxStatic}/static/libs/bootstrap.min.js"></script>
<script src="${ctxStatic}/static/libs/SM4.min.js?V=${config.getDvVersion()}"></script>
<#-- iCheck -->
<script src="${ctxStatic}/static/libs/icheck.min.js"></script>
<#-- 全局遮罩-->
<script src="${ctxStatic}/static/plugins/blockUI/jquery.blockUI.min.js"></script>
<#-- jQuery toast 提示框  -->
<script src="${ctxStatic}/static/libs/jquery.toast.min.js"></script>
<script src="${ctxStatic}/static/libs/vue.min.js"></script>
<#if verification>
<script src="${ctxStatic}/static/plugins/captcha/crypto-js.min.js"></script>
<script src="${ctxStatic}/static/plugins/captcha/ase.min.js"></script>
<script src="${ctxStatic}/static/plugins/captcha/verify.min.js"></script>
</#if>
<script>var ctx = "${ctxStatic}/", _secretKey = "${_secretKey}";</script>
<script>
    var vm = new Vue({
        el:'#app',
        data:{
            username: '',
            password: '',
            captcha: '',
            /*errorMsg: '',*/
            rememberme : false,
            loadcode : false,
            src: 'captcha.gif'
        },
        beforeCreate: function(){
            if(self != top){
                top.location.href = self.location.href;
            }
        },
        methods: {
            refreshCode: function(){ /*刷新验证码*/
                this.src = ctx+"captcha.gif?t=" + $.now();
            },
            _onkeydown : function(e){
                var that = this;
                if(e && e.keyCode==13) { /* enter 键 */
                    that.login();
                }
            },
            login: function (event) {
                var that = this;
                if(this.getCookie("_secretKey") == ""){
                    location.reload();
                    return;
                }
                if(vm.username.length < 3 ||  vm.password.length < 3){
                    return that.errrInfo('<@ctx.i18n text = "账号或者密码输入有误"/>');
                }
                <#if verification>
                $("#verfyImg").find(".mask").css("display","block");
                <#else>
                $(window).block({ message: '<div class="loaderbox"><div class="loading-activity"></div> '
                        + '<@ctx.i18n text = "数据正在认证,请稍后..."/>' + '</div>' });
                var s4=new SM4Util(that.getCookie("_secretKey"));
                var data = {"username":s4.encryptData_ECB(vm.username),
                    "password":s4.encryptData_ECB(vm.password),
                    "captcha":vm.captcha,
                    "rememberMe":vm.rememberme};
                that.postLogin(data,true);
                </#if>
                return;
            },
            errrInfo : function(text){
                $.toast({
                    heading: '<@ctx.i18n text = "警告"/>',
                    text: text,
                    hideAfter:3000,
                    position: {
                        right: 8,
                        bottom: 4
                    },
                    textAlign: 'left',
                    showHideTransition: 'slide',
                    allowToastClose: true,
                    loader: true,
                    /*stack: 5,*/
                    icon: 'error'
                })
            },
            getCookie:function(c_name){
                if (document.cookie.length>0){
                    c_start=document.cookie.indexOf(c_name + "=");
                    if (c_start!=-1){
                        c_start=c_start + c_name.length+1;
                        c_end=document.cookie.indexOf(";",c_start);
                        if (c_end==-1) {
                            c_end=document.cookie.length
                        };
                        return unescape(document.cookie.substring(c_start,c_end))
                    }
                };
                return _secretKey;
            },
            postLogin: function(data,flag){
                $.ajax({
                    type: "POST",
                    url: ctx+"login",
                    data: data,
                    dataType: "json",
                    success: function(result){
                        if(result.code == 0){
                            if($("input[name='rememberUserCode']").is(':checked')){
                                window.localStorage.setItem('rememberUserCode',vm.username);
                            }else{
                                window.localStorage.setItem('rememberUserCode',"");
                            };
                            setTimeout(
                                function () {
                                    location.href ='index';
                                }
                                , 100);
                        }else if(result.code == '50004' || result.code == '50006'){
                            if(flag){$(window).unblock()};
                            vm.loadcode = true;
                            vm.errrInfo(result.msg);
                            vm.captcha = '';
                            vm.password = '';
                            vm.refreshCode();
                        }
                        else{
                            if(flag){$(window).unblock()};
                            vm.errrInfo(result.msg);
                            vm.captcha = '';
                            vm.password = '';
                            vm.refreshCode();
                        }
                    }
                });
            }
        },
        mounted :function(){
            var that = this;

            if(window.localStorage.getItem('rememberUserCode') && window.localStorage.getItem('rememberUserCode') != ""){
                $("input[name='rememberUserCode']").iCheck('check');
                this.username = window.localStorage.getItem('rememberUserCode');
            }else{
                $("input[name='rememberUserCode']").iCheck('uncheck');
            }

            /*绑定记住我样式*/
            $("input[type=checkbox]").each(function () {
                $(this).iCheck({
                    checkboxClass: "icheckbox_" + ($(this).data("style") || "square-blue"),
                    radioClass: "iradio_" + ($(this).data("style") || "square-blue")
                }).on('ifChanged', function(event){
                    if($(this).attr("name") == "rememberme"){
                        if($(this).is(':checked')){
                            vm.rememberme = true;
                        }else{
                            vm.rememberme = false;
                        }
                    }
                });
            });

            <#if verification>
            /** 初始化验证码  弹出式 */
            $('#verfyImg').slideVerify({
                baseUrl:'${ctxStatic}',
                mode:'pop',
                success : function(params) {
                    var s4=new SM4Util(that.getCookie("_secretKey"));
                    var data = {"username":s4.encryptData_ECB(vm.username),
                        "password":s4.encryptData_ECB(vm.password),
                        "captcha":vm.captcha,
                        "rememberMe":vm.rememberme};
                    data = $.extend(data, params);
                    that.postLogin(data,false);
                },
                error : function() {}
            });
            </#if>

            /*设置tooltip*/
            $('[data-toggle="tooltip"]').each(function () {
                $(this).tooltip();
            });

            /*获取页面键盘事件*/
            window.document.onkeydown = that._onkeydown;
        }
    });
</script>
</html>
</@pageTheme>